<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>stm32f4_blink_led: D:/123/stm32f4_blink_led-1.2.2-120323/gpio.c File Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />



</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">stm32f4_blink_led
   &#160;<span id="projectnumber">1.2.2-120323</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.6.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="summary">
<a href="#define-members">Defines</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">D:/123/stm32f4_blink_led-1.2.2-120323/gpio.c File Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>GPIO driver.  
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &lt;stdint.h&gt;</code><br/>
<code>#include &quot;<a class="el" href="stm32f4xx_8h_source.html">inc/stm32f4xx.h</a>&quot;</code><br/>
<code>#include &quot;<a class="el" href="hdr__gpio_8h_source.html">hdr/hdr_gpio.h</a>&quot;</code><br/>
<code>#include &quot;<a class="el" href="gpio_8h_source.html">gpio.h</a>&quot;</code><br/>
</div><div class="textblock"><div class="dynheader">
Include dependency graph for gpio.c:</div>
<div class="dyncontent">
<div class="center"><img src="gpio_8c__incl.png" border="0" usemap="#_d_1_2123_2stm32f4__blink__led-1_82_82-120323_2gpio_8c" alt=""/></div>
<map name="_d_1_2123_2stm32f4__blink__led-1_82_82-120323_2gpio_8c" id="_d_1_2123_2stm32f4__blink__led-1_82_82-120323_2gpio_8c">
<area shape="rect" id="node5" href="stm32f4xx_8h.html" title="CMSIS Cortex&#45;M4 Device Peripheral Access Layer Header File. This file contains all the peripheral reg..." alt="" coords="87,155,209,181"/><area shape="rect" id="node19" href="hdr__gpio_8h.html" title="Header with values of bitfields in GPIO control registers." alt="" coords="233,155,348,181"/><area shape="rect" id="node21" href="gpio_8h.html" title="Header for gpio.c." alt="" coords="185,80,247,107"/><area shape="rect" id="node7" href="core__cm4_8h.html" title="CMSIS Cortex&#45;M4 Core Peripheral Access Layer Header File." alt="" coords="119,229,216,256"/><area shape="rect" id="node16" href="system__stm32f4xx_8h.html" title="CMSIS Cortex&#45;M4 Device System Source File for STM32F4xx devices." alt="" coords="241,229,396,256"/><area shape="rect" id="node10" href="core__cm_instr_8h.html" title="CMSIS Cortex&#45;M Core Instruction Access Header File." alt="" coords="100,304,217,331"/><area shape="rect" id="node12" href="core__cm_func_8h.html" title="CMSIS Cortex&#45;M Core Function Access Header File." alt="" coords="242,304,360,331"/><area shape="rect" id="node14" href="core__cm4__simd_8h.html" title="CMSIS Cortex&#45;M4 SIMD Header File." alt="" coords="385,304,519,331"/></map>
</div>
</div><table class="memberdecls">
<tr><td colspan="2"><h2><a name="define-members"></a>
Defines</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a3652c7d330d59dba7725e6a6d3f48710"></a><!-- doxytag: member="gpio.c::GPIO_GET_MODER" ref="a3652c7d330d59dba7725e6a6d3f48710" args="(combination)" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><b>GPIO_GET_MODER</b>(combination)&#160;&#160;&#160;(((combination) &amp; 0xF) &gt;&gt; 0)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="acc1412480ea02e5aa853f254327dd387"></a><!-- doxytag: member="gpio.c::GPIO_GET_OTYPER" ref="acc1412480ea02e5aa853f254327dd387" args="(combination)" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><b>GPIO_GET_OTYPER</b>(combination)&#160;&#160;&#160;(((combination) &amp; 0xF0) &gt;&gt; 4)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a8e74ad18ead074c9f6640c4bdec3b012"></a><!-- doxytag: member="gpio.c::GPIO_GET_OSPEEDR" ref="a8e74ad18ead074c9f6640c4bdec3b012" args="(combination)" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><b>GPIO_GET_OSPEEDR</b>(combination)&#160;&#160;&#160;(((combination) &amp; 0xF00) &gt;&gt; 8)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a5f555454cf91695542004db694cfc52e"></a><!-- doxytag: member="gpio.c::GPIO_GET_PUPDR" ref="a5f555454cf91695542004db694cfc52e" args="(combination)" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><b>GPIO_GET_PUPDR</b>(combination)&#160;&#160;&#160;(((combination) &amp; 0xF000) &gt;&gt; 12)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a2f5aac0f8ae11c6a288b0c61113c9635"></a><!-- doxytag: member="gpio.c::GPIO_GET_AFR" ref="a2f5aac0f8ae11c6a288b0c61113c9635" args="(combination)" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><b>GPIO_GET_AFR</b>(combination)&#160;&#160;&#160;(((combination) &amp; 0xF0000) &gt;&gt; 16)</td></tr>
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="gpio_8c.html#afdbe206b3c49f019757ab09b3cf52b9c">gpio_init</a> (void)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">GPIO initialization.  <a href="#afdbe206b3c49f019757ab09b3cf52b9c"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="gpio_8c.html#ab288132781af1b76dbcd1ef7b039890a">gpio_pin_cfg</a> (<a class="el" href="struct_g_p_i_o___type_def.html">GPIO_TypeDef</a> *port_ptr, uint32_t pin, uint32_t configuration)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Configures pin.  <a href="#ab288132781af1b76dbcd1ef7b039890a"></a><br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>GPIO default configuration and function for configuring a pin </p>
<dl class="author"><dt><b>Author:</b></dt><dd>Freddie Chopin, <a href="http://www.freddiechopin.info/">http://www.freddiechopin.info/</a> </dd></dl>
<dl class="date"><dt><b>Date:</b></dt><dd>2012-03-17 </dd></dl>
</div><hr/><h2>Function Documentation</h2>
<a class="anchor" id="afdbe206b3c49f019757ab09b3cf52b9c"></a><!-- doxytag: member="gpio.c::gpio_init" ref="afdbe206b3c49f019757ab09b3cf52b9c" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="gpio_8h.html#afdbe206b3c49f019757ab09b3cf52b9c">gpio_init</a> </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Enables all GPIO ports. </p>

<p><div class="dynheader">
Here is the caller graph for this function:</div>
<div class="dyncontent">
<div class="center"><img src="gpio_8c_afdbe206b3c49f019757ab09b3cf52b9c_icgraph.png" border="0" usemap="#gpio_8c_afdbe206b3c49f019757ab09b3cf52b9c_icgraph" alt=""/></div>
<map name="gpio_8c_afdbe206b3c49f019757ab09b3cf52b9c_icgraph" id="gpio_8c_afdbe206b3c49f019757ab09b3cf52b9c_icgraph">
<area shape="rect" id="node3" href="main_8c.html#a59ae3966a97431553c8ed0411bdd7937" title="Initializes system." alt="" coords="129,5,223,32"/><area shape="rect" id="node5" href="main_8c.html#a840291bc02cba5474a4cb46a9b9566fe" title="main code block" alt="" coords="273,5,327,32"/></map>
</div>
</p>

</div>
</div>
<a class="anchor" id="ab288132781af1b76dbcd1ef7b039890a"></a><!-- doxytag: member="gpio.c::gpio_pin_cfg" ref="ab288132781af1b76dbcd1ef7b039890a" args="(GPIO_TypeDef *port_ptr, uint32_t pin, uint32_t configuration)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="gpio_8h.html#ab288132781af1b76dbcd1ef7b039890a">gpio_pin_cfg</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_g_p_i_o___type_def.html">GPIO_TypeDef</a> *&#160;</td>
          <td class="paramname"><em>port_ptr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>pin</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>configuration</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Configures one pin in one port.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">port_ptr</td><td>points to the configuration structure of desired port </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">pin</td><td>selects one pin, [0; 15] </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">configuration</td><td>is a combined value of MODER, OTYPER, OSPEEDR, PUPDR and AFRx register bitfields, allowed values {GPIO_IN_FLOATING, GPIO_IN_PULL_UP, GPIO_IN_PULL_DOWN, GPIO_OUT_{PP, OD}_{2MHz, 25MHz, 50MHz, 100MHz}, GPIO_OUT_{PP, OD}_{2MHz, 25MHz, 50MHz, 100MHz}_{PULL_UP, PULL_DOWN}, GPIO_[AF0; AF15]_{PP, OD}_{2MHz, 25MHz, 50MHz, 100MHz}, GPIO_[AF0; AF15]_{PP, OD}_{2MHz, 25MHz, 50MHz, 100MHz}_{PULL_UP, PULL_DOWN}, GPIO_ANALOG} </td></tr>
  </table>
  </dd>
</dl>

<p><div class="dynheader">
Here is the caller graph for this function:</div>
<div class="dyncontent">
<div class="center"><img src="gpio_8c_ab288132781af1b76dbcd1ef7b039890a_icgraph.png" border="0" usemap="#gpio_8c_ab288132781af1b76dbcd1ef7b039890a_icgraph" alt=""/></div>
<map name="gpio_8c_ab288132781af1b76dbcd1ef7b039890a_icgraph" id="gpio_8c_ab288132781af1b76dbcd1ef7b039890a_icgraph">
<area shape="rect" id="node3" href="main_8c.html#a840291bc02cba5474a4cb46a9b9566fe" title="main code block" alt="" coords="155,5,210,32"/></map>
</div>
</p>

</div>
</div>
</div><!-- contents -->


<hr class="footer"/><address class="footer"><small>
Generated on Fri Mar 23 2012 00:11:20 for stm32f4_blink_led by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>

</body>
</html>
